package com.ruoyi.consume.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consume.mapper.SeedApplyTemporaryConMapper;
import com.ruoyi.consume.domain.SeedApplyTemporaryCon;
import com.ruoyi.consume.service.ISeedApplyTemporaryConService;

/**
 * 种子临时领用Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-27
 */
@Service
public class SeedApplyTemporaryConServiceImpl implements ISeedApplyTemporaryConService
{
    @Autowired
    private SeedApplyTemporaryConMapper seedApplyTemporaryConMapper;

    /**
     * 查询种子临时领用
     *
     * @param seedApplyTemporaryId 种子临时领用ID
     * @return 种子临时领用
     */
    @Override
    public SeedApplyTemporaryCon selectSeedApplyTemporaryById(Long seedApplyTemporaryId)
    {
        return seedApplyTemporaryConMapper.selectSeedApplyTemporaryById(seedApplyTemporaryId);
    }

    /**
     * 查询种子临时领用列表
     *
     * @param seedApplyTemporaryCon 种子临时领用
     * @return 种子临时领用
     */
    @Override
    public List<SeedApplyTemporaryCon> selectSeedApplyTemporaryList(SeedApplyTemporaryCon seedApplyTemporaryCon)
    {
        return seedApplyTemporaryConMapper.selectSeedApplyTemporaryList(seedApplyTemporaryCon);
    }

    /**
     * 新增种子临时领用
     *
     * @param seedApplyTemporaryCon 种子临时领用
     * @return 结果
     */
    @Override
    public int insertSeedApplyTemporary(SeedApplyTemporaryCon seedApplyTemporaryCon)
    {
        seedApplyTemporaryCon.setCreateTime(DateUtils.getNowDate());
        return seedApplyTemporaryConMapper.insertSeedApplyTemporary(seedApplyTemporaryCon);
    }

    /**
     * 修改种子临时领用
     *
     * @param seedApplyTemporaryCon 种子临时领用
     * @return 结果
     */
    @Override
    public int updateSeedApplyTemporary(SeedApplyTemporaryCon seedApplyTemporaryCon)
    {
        seedApplyTemporaryCon.setUpdateTime(DateUtils.getNowDate());
        return seedApplyTemporaryConMapper.updateSeedApplyTemporary(seedApplyTemporaryCon);
    }

    /**
     * 批量删除种子临时领用
     *
     * @param seedApplyTemporaryIds 需要删除的种子临时领用ID
     * @return 结果
     */
    @Override
    public int deleteSeedApplyTemporaryByIds(Long[] seedApplyTemporaryIds)
    {
        return seedApplyTemporaryConMapper.deleteSeedApplyTemporaryByIds(seedApplyTemporaryIds);
    }

    /**
     * 删除种子临时领用信息
     *
     * @param seedApplyTemporaryId 种子临时领用ID
     * @return 结果
     */
    @Override
    public int deleteSeedApplyTemporaryById(Long seedApplyTemporaryId)
    {
        return seedApplyTemporaryConMapper.deleteSeedApplyTemporaryById(seedApplyTemporaryId);
    }

    /**
     * 更新库存量表
     *
     * @param seedApplyTemporaryCon 种子临时领用
     * @return 结果
     */
    @Override
    public int updateAmount(SeedApplyTemporaryCon seedApplyTemporaryCon){
        return seedApplyTemporaryConMapper.updateAmount(seedApplyTemporaryCon);
    }

    /**
     * 更新领用状态
     *
     * @param seedApplyTemporaryId 种子临时领用ID
     * @return 结果
     */
    @Override
    public int updateConsumeStatus(Long seedApplyTemporaryId){
        return seedApplyTemporaryConMapper.updateConsumeStatus(seedApplyTemporaryId);
    }

    /**
     * 退回操作
     *
     * @param seedApplyTemporaryId 种子临时领用ID
     * @return 结果
     */
    @Override
    public int updateApprovalStatus(Long seedApplyTemporaryId){
        return seedApplyTemporaryConMapper.updateApprovalStatus(seedApplyTemporaryId);
    }
}
